﻿using System;
using System.Collections; 
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RSDataEdit
{
    class RSColumn
    {
        public String Name = "";
        public String Description = "";
        public bool Visible = false;
        public uint VisibleNumber = 0;
        public RSEditTypes EditType = RSEditTypes.NoEdit;

        public RSColumn()
        {
        }
        public RSColumn(String newName)
        {
            Name = newName;
        }

        public override bool Equals(System.Object obj)
        {
            if (obj == null)
                return false;
            RSColumn p = obj as RSColumn;
            if ((System.Object)p == null)
                return false;
            return (Name == p.Name);
        }
        public bool Equals(RSColumn p)
        {
            if ((object)p == null)
                return false;
            return (Name == p.Name);
        }
        public override int GetHashCode()
        {
            return Name.GetHashCode();
        }


    }

    public class RSColumnComparerVidible : IComparer<RSColumn>
    {
        int IComparer<RSColumn>.Compare(RSColumn x, RSColumn y)
        {
            if (!x.Visible && !y.Visible)
                return 0;
            else if (x.Visible && !y.Visible)
                return -500;
            else if (!x.Visible && y.Visible)
                return 500;
            else
                return (int)x.VisibleNumber - (int)y.VisibleNumber;
        }
    }
}
